<?php

/**
 * @author littlexiang
 * @version $Id: StationModel.php 62 2009-07-22 04:45:58Z littlexiang521 $
 *
 */
class StationModel extends Model {
    protected $_table = 'station';
    public function getLines () {
        $q = 'SELECT DISTINCT line
        		FROM station';
        return $this->fetchAll($q);
    }
    
    public function getStations () {
        return $this->retriveAll();
    }
    
    public function getStationsByLine ($line) {
        return $this->retriveAll('line = ?', array(
            $line));
    }
    
    public function getStationsOfSameLine ($station) {
        return $this->retriveAll("line = (SELECT line FROM $this->stationTable WHERE id = ?)", array(
            $station));
    }
}
?>